package com.school.lab.service.impl;

import java.util.List;

import com.school.lab.dao.UserDao;
import com.school.lab.domain.User;
import com.school.lab.service.UserService;

public class UserServiceImpl implements UserService {
	
	private UserDao userDao;

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	/* (non-Javadoc)
	 * @see com.sw.service.UserService#delUser(java.lang.Long)
	 */
	
	public void delUser(Long userId) {
		userDao.delete(userId);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.UserService#getUserById(java.lang.Long)
	 */
	
	public User getUserById(Long userId) {
		return userDao.get(userId);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.UserService#saveUser(com.sw.domain.User)
	 */
	
	public void saveUser(User user) {
		
		userDao.save(user);
	}

	/* (non-Javadoc)
	 * @see com.sw.service.UserService#updateUser(com.sw.domain.User)
	 */
	
	public void updateUser(User user) {
		
		userDao.saveOrUpdate(user);
	}

	public List<User> findByType(int start, int limit, int flag, String userType) {
	
		return userDao.findByType(start, limit, flag, userType);
	}

	
	public User getUser(String username, String password, String city,
			String flag) {
	
		return userDao.getUser(username, password, city, flag);
	}

	
	public List<User> findByType(int start, int limit, int flag,
			String userType, String city,int isTopAdmin) {
		
		return userDao.findByType(start, limit, flag, userType, city,isTopAdmin);
	}

	
	public List<User> findUser(int start, int limit, int flag, String roleName,
			String city, String realName) {
		
		return userDao.findUser(start, limit, flag, roleName, city, realName);
	}

	
	public User getUser(String username, String password) {
		
		return this.userDao.getUser(username, password);
	}


	public User searchUser(String username, String realName) {
		
		return this.userDao.searchUser(username, realName);
	}

	public User getByName(String username) {
		
		return this.userDao.getByName(username);
	}


	public List<User> findUser(int start, int limit, int flag, String roleName,
			String city, String realName, String username, String grade) {
		return userDao.findUser(start, limit, flag, roleName, city, realName, username, grade);
	}

}
